// components/swiper-photo/swiper-photo.js
import throttle from '../../utils/throttle.js'
Component({
    /**
     * 组件的属性列表
     */
    properties: {
        imgArr: {
            type: Array,
            value: []
        },
        desArr: {
            type: Array,
            value: []
        },
        idArr: {
            type: Array,
            value: []
        },
        width: {
            type: String,
            value: '268rpx'
        },
        height: {
            type: String,
            value: '178rpx'
        },
        // 图片间距
        gap: {
            type: String,
            value: '12rpx'
        },
        // 前边距
        prevMargin: {
            type: String,
            value: '30rpx'
        },
        // 后边距
        nextMargin: {
            type: String,
            value: '30rpx'
        },
        nav: {
            type: String,
            value: ''
        }
    },

    /**
     * 组件的初始数据
     */
    data: {

    },

    /**
     * 组件的方法列表
     */
    methods: {
        changeNav: throttle(e => {
            let {
                nav
            } = e.currentTarget.dataset;
            wx.navigateTo({
                url: `${nav}`
            })
        }, 200),

        trigger() {
            this.triggerEvent('scrolltolower')
        }
    }
})